package com.zmn.plat.services.impl.notice;

import com.zmn.plat.model.entity.notice.Notice;
import com.zmn.plat.model.entity.notice.NoticeQuery;
import com.zmn.plat.persistence.interfaces.notice.NoticeDao;
import com.zmn.plat.services.interfaces.notice.NoticeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;



@Service
public class NoticeServiceImpl implements NoticeService {

    @Resource
    NoticeDao noticeDao;

    @Override
    public Notice findByKey(Integer relateId) {
        return noticeDao.findByKey(relateId);
    }

    @Override
    public List<Notice> listPageByQuery(NoticeQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return noticeDao.listPageByQuery(query);
    }

    @Override
    public List<Notice> listByQuery(NoticeQuery query) {
        return noticeDao.listByQuery(query);
    }

    @Override
    public List<Notice> listAll() {
        return noticeDao.listAll();
    }

    @Override
    public Integer countByQuery(NoticeQuery query) {
        return noticeDao.countByQuery(query);
    }
    @Override
    public Integer updateStatusByKey(Notice notice) {
        return noticeDao.updateStatusByKey(notice);
    }

    @Override
    public Integer updateStatusBatchByKey(List<Integer> ids, Integer status, String mcStaffName) {
        return noticeDao.updateBatchStatusByKey(ids, status, mcStaffName);
    }
    @Override
    public Integer updateByKey(Notice notice) {
        return noticeDao.updateByKey(notice);
    }

    @Override
    public Integer insert(Notice notice) {
        return noticeDao.insert(notice);
    }

    @Override
    public Integer deleteByKey(Integer relateId) {
        return noticeDao.deleteByKey(relateId);
    }

}